home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1997 / MacHack 1997.toast / Hacks / Hacks ’96 / Audio dcmds / Audio CD dcmds.sit / Audio CD dcmds.π / play dcmd / cd.h < prev    next >
Text File  |  1995-06-26  |  6KB  |  273 lines

  1. // imWare
  2. // Wednesday, February 14, 1990
  3. // James Beninghaus
  4.  
  5. #ifndef __FILES__
  6.     #include    <Files.h>
  7. #endif
  8. #ifndef __DEVICES__
  9.     #include    <Devices.h>
  10. #endif
  11.  
  12. #define csVerifyTheDisc    5
  13. #define csWhoIsThere    97
  14. #define csReadTOC        100
  15. #define csReadQ            101
  16. #define csATrkSearch    103
  17. #define csAPlay            104
  18. #define csAPause        105
  19. #define csAStop            106
  20. #define csAStatus        107
  21. #define csAScan            108
  22. #define csASetVolume    109
  23. #define csAGetVolume    112
  24.  
  25. #define BLOCKADDR        0
  26. #define    MSFADDR            1
  27. #define TRACKADDR        2
  28.  
  29. #define TOCTRACKS        1
  30. #define TOCENDOFDISK    2
  31. #define TOCSTARTADDR    3
  32.  
  33. #define STEREO            9
  34. #define MONO            15
  35.  
  36. #define START            0
  37. #define STOP            1
  38.  
  39. #define PAUSE            1
  40. #define CONTINUE        0
  41.  
  42. #define    PLAYING            0
  43. #define    PAUSED            1
  44.  
  45. //typedef    unsigned char    Byte;
  46. typedef unsigned short    Word;
  47. typedef    unsigned long    Long;
  48.  
  49. typedef struct WhoIsThereRec {
  50.     QElemPtr                        qLink;
  51.     short                            qType;
  52.     short                            ioTrap;
  53.     Ptr                                ioCmdAddr;
  54.     IOCompletionUPP                    ioCompletion;
  55.     OSErr                            ioResult;
  56.     StringPtr                        ioNamePtr;
  57.     short                            ioVRefNum;
  58.     short        ioRefNum;
  59.     short        csCode;
  60.     struct {
  61.         Byte    fill;
  62.         Byte    SCSIMask;
  63.     } csParam;
  64. } WhoIsThereRec;
  65.  
  66. typedef struct AStatusRec {
  67.     QElemPtr                        qLink;
  68.     short                            qType;
  69.     short                            ioTrap;
  70.     Ptr                                ioCmdAddr;
  71.     IOCompletionUPP                    ioCompletion;
  72.     OSErr                            ioResult;
  73.     StringPtr                        ioNamePtr;
  74.     short                            ioVRefNum;
  75.     short        ioRefNum;
  76.     short        csCode;
  77.     struct {
  78.         Byte    audioStatus;
  79.         Byte    playMode;
  80.         Byte    cntlField;
  81.         Byte    minutes;
  82.         Byte    seconds;
  83.         Byte    frames;
  84.     } csParam;
  85. } AStatusRec;
  86.  
  87. typedef struct AVolumeRec {
  88.     QElemPtr                        qLink;
  89.     short                            qType;
  90.     short                            ioTrap;
  91.     Ptr                                ioCmdAddr;
  92.     IOCompletionUPP                    ioCompletion;
  93.     OSErr                            ioResult;
  94.     StringPtr                        ioNamePtr;
  95.     short                            ioVRefNum;
  96.     short        ioRefNum;
  97.     short        csCode;
  98.     struct {
  99.         Byte    leftChannel;
  100.         Byte    rightChannel;
  101.         short    unused[9];
  102.     } csParam;
  103. } AVolumeRec;
  104.  
  105. typedef struct {
  106.     Byte        cntlField;
  107.     Byte        minutes;
  108.     Byte        seconds;
  109.     Byte        frames;
  110. } StartAddrRec;
  111.  
  112. typedef struct {
  113.     Byte        minutes;
  114.     Byte        seconds;
  115.     Byte        frames;
  116.     Byte        filler;
  117. } OffsetStartAddrRec;
  118.  
  119.  
  120. typedef struct ReadTOCRec {
  121.     QElemPtr                        qLink;
  122.     short                            qType;
  123.     short                            ioTrap;
  124.     Ptr                                ioCmdAddr;
  125.     IOCompletionUPP                    ioCompletion;
  126.     OSErr                            ioResult;
  127.     StringPtr                        ioNamePtr;
  128.     short                            ioVRefNum;
  129.     short        ioRefNum;
  130.     short        csCode;
  131.     union {
  132.         Word    type;
  133.         Byte    addr[3];
  134.         struct {
  135.             Word    fill;
  136.             Long    data;
  137.             Word    length;
  138.             Byte    track;
  139.         } buffer;
  140.     } csParam;
  141. } ReadTOCRec;
  142.  
  143. typedef struct ReadQRec {
  144.     QElemPtr                        qLink;
  145.     short                            qType;
  146.     short                            ioTrap;
  147.     Ptr                                ioCmdAddr;
  148.     IOCompletionUPP                    ioCompletion;
  149.     OSErr                            ioResult;
  150.     StringPtr                        ioNamePtr;
  151.     short                            ioVRefNum;
  152.     short        ioRefNum;
  153.     short        csCode;
  154.     struct {
  155.         Byte    cntlField;
  156.         Byte    currentTrack;
  157.         StartAddrRec    addrFromTrackStart;
  158.         OffsetStartAddrRec    addrFromDiscStart;
  159.         Byte    fill;
  160.     } csParam;
  161. } ReadQRec;
  162.  
  163. typedef struct APlayRec {
  164.     QElemPtr                        qLink;
  165.     short                            qType;
  166.     short                            ioTrap;
  167.     Ptr                                ioCmdAddr;
  168.     IOCompletionUPP                    ioCompletion;
  169.     OSErr                            ioResult;
  170.     StringPtr                        ioNamePtr;
  171.     short                            ioVRefNum;
  172.     short        ioRefNum;
  173.     short        csCode;
  174.     struct {
  175.         Word    type;
  176.         Byte    addr[4];
  177.         Word    startStop;
  178.         Byte    fill;
  179.         Byte    playMode;
  180.     } csParam;
  181. } APlayRec;
  182.  
  183. typedef struct ATrkSearchRec {
  184.     QElemPtr                        qLink;
  185.     short                            qType;
  186.     short                            ioTrap;
  187.     Ptr                                ioCmdAddr;
  188.     IOCompletionUPP                    ioCompletion;
  189.     OSErr                            ioResult;
  190.     StringPtr                        ioNamePtr;
  191.     short                            ioVRefNum;
  192.     short        ioRefNum;
  193.     short        csCode;
  194.     struct {
  195.         Word    type;
  196.         Byte    addr[4];
  197.         Word    playFlag;
  198.         Byte    fill;
  199.         Byte    playMode;
  200.     } csParam;
  201. } ATrkSearchRec;
  202.  
  203. typedef struct AStopRec {
  204.     QElemPtr                        qLink;
  205.     short                            qType;
  206.     short                            ioTrap;
  207.     Ptr                                ioCmdAddr;
  208.     IOCompletionUPP                    ioCompletion;
  209.     OSErr                            ioResult;
  210.     StringPtr                        ioNamePtr;
  211.     short                            ioVRefNum;
  212.     short        ioRefNum;
  213.     short        csCode;
  214.     struct {
  215.         Word    type;
  216.         Byte    addr[4];
  217.     } csParam;
  218. } AStopRec;
  219.  
  220. typedef struct APauseRec {
  221.     QElemPtr                        qLink;
  222.     short                            qType;
  223.     short                            ioTrap;
  224.     Ptr                                ioCmdAddr;
  225.     IOCompletionUPP                    ioCompletion;
  226.     OSErr                            ioResult;
  227.     StringPtr                        ioNamePtr;
  228.     short                            ioVRefNum;
  229.     short        ioRefNum;
  230.     short        csCode;
  231.     struct {
  232.         Long    state;
  233.     } csParam;
  234. } APauseRec;
  235.  
  236. typedef struct AScanRec {
  237.     QElemPtr                        qLink;
  238.     short                            qType;
  239.     short                            ioTrap;
  240.     Ptr                                ioCmdAddr;
  241.     IOCompletionUPP                    ioCompletion;
  242.     OSErr                            ioResult;
  243.     StringPtr                        ioNamePtr;
  244.     short                            ioVRefNum;
  245.     short        ioRefNum;
  246.     short        csCode;
  247.     struct {
  248.         Word    type;
  249.         Byte    addr[4];
  250.         Word    directionFlag;
  251.         Byte    fill;
  252.     } csParam;
  253. } AScanRec;
  254.  
  255. void            Usage        (void);
  256. pascal    Byte    Decimal2BCD    (Byte n);
  257. pascal    Byte    BCD2Decimal    (Byte n);
  258. pascal    OSErr    EjectCD        (short ioRefNum);
  259. pascal    OSErr    OpenCD        (Byte CDDrive, short *ioRefNum);
  260. pascal    OSErr    APlay        (short ioRefNum, Byte startTrack, Byte playMode);
  261. pascal    OSErr    APause        (short ioRefNum, Long state);
  262. pascal    OSErr    AStop        (short ioRefNum, Byte stopTrack);
  263. pascal    OSErr    ATrkSearch    (short ioRefNum, Byte track, Byte playFlag, Byte playMode);
  264. pascal    OSErr    AStatus        (short ioRefNum, Byte *audioStatus, Byte *playMode, Byte *cntlField, Byte *minutes, Byte *seconds, Byte *frames);
  265. pascal    OSErr    TrackCount    (short ioRefNum, Byte *lastTrack);
  266. pascal    OSErr    TrackInfo    (short ioRefNum, Byte track, Byte *cntlField, Byte *minutes, Byte *seconds, Byte *frames);
  267. pascal    OSErr     AScan(short ioRefNum, Byte startMin, Byte startSec, Byte startFrame, Byte direction);
  268. pascal    OSErr     ACurrInfo(short ioRefNum, Byte *currentTrack, Byte *discMinutes, Byte *discSeconds, Byte *discFrames);
  269. pascal    OSErr     ACurrTrackInfo(short ioRefNum, Byte *currentTrack, Byte *discMinutes, Byte *discSeconds, Byte *discFrames);
  270. pascal     OSErr     AGetVolume(short ioRefNum, short *volume);
  271. pascal     OSErr     ASetVolume(short ioRefNum, short volume);
  272. pascal Boolean    DiscInDrive(short ioRefNum);
  273.